diff --git a/swh/web/templates/browse/browse.html b/swh/web/templates/browse/browse.html --- a/swh/web/templates/browse/browse.html +++ b/swh/web/templates/browse/browse.html @@ -15,11 +15,11 @@ {% if snapshot_context %}

- Browse archived {{ swh_object_name.lower }} + {% if snapshot_context.origin_info %} - for origin + Browse archived {{ swh_object_name.lower }} for origin - {% url 'browse-origin' %}?origin_url={{ snapshot_context.origin_info.url }} + {{ snapshot_context.origin_info.url }} {% if snapshot_context.origin_info.url|slice:"0:4" == "http" %} @@ -27,7 +27,7 @@ {% endif %} {% else %} - for snapshot + Browse archived {{ swh_object_name.lower }} for snapshot {{ snapshot_context.snapshot_swhid }} diff --git a/swh/web/tests/browse/views/test_content.py b/swh/web/tests/browse/views/test_content.py --- a/swh/web/tests/browse/views/test_content.py +++ b/swh/web/tests/browse/views/test_content.py @@ -3,6 +3,8 @@ # License: GNU Affero General Public License version 3, or any later version # See top-level LICENSE file for more information +import textwrap + from django.utils.html import escape from hypothesis import given @@ -61,6 +63,18 @@ swh_cnt_id_url = reverse("browse-swh-id", url_args={"swh_id": swh_cnt_id}) assert_contains(resp, swh_cnt_id) assert_contains(resp, swh_cnt_id_url) + assert_contains( + resp, + textwrap.indent( + ( + f"Browse archived content\n" + f'\n' + f" {swh_cnt_id}\n" + f"" + ), + " " * 4, + ), + ) @given(content_text_no_highlight()) diff --git a/swh/web/tests/browse/views/test_directory.py b/swh/web/tests/browse/views/test_directory.py --- a/swh/web/tests/browse/views/test_directory.py +++ b/swh/web/tests/browse/views/test_directory.py @@ -4,6 +4,7 @@ # See top-level LICENSE file for more information import random +import textwrap from hypothesis import given @@ -147,3 +148,16 @@ swh_dir_id_url = reverse("browse-swh-id", url_args={"swh_id": swh_dir_id}) assert_contains(resp, swh_dir_id) assert_contains(resp, swh_dir_id_url) + + assert_contains( + resp, + textwrap.indent( + ( + f"Browse archived directory\n" + f'\n' + f" {swh_dir_id}\n" + f"" + ), + " " * 4, + ), + ) diff --git a/swh/web/tests/browse/views/test_origin.py b/swh/web/tests/browse/views/test_origin.py --- a/swh/web/tests/browse/views/test_origin.py +++ b/swh/web/tests/browse/views/test_origin.py @@ -7,6 +7,7 @@ import random import re import string +import textwrap from django.utils.html import escape @@ -67,6 +68,8 @@ ) assert_contains(resp, browse_dir_url) + _check_origin_view_title(resp, origin["url"], "visits") + @given(origin_with_multiple_visits()) def test_origin_content_view(client, archive_data, origin): @@ -844,6 +847,8 @@ assert_contains(resp, "swh-take-new-snapshot") + _check_origin_view_title(resp, origin_info["url"], "content") + def _origin_directory_view_test_helper( client, @@ -976,6 +981,8 @@ assert_contains(resp, "swh-take-new-snapshot") + _check_origin_view_title(resp, origin_info["url"], "directory") + def _origin_branches_test_helper(client, origin_info, origin_snapshot): query_params = {"origin_url": origin_info["url"]} @@ -1021,6 +1028,8 @@ ) assert_contains(resp, '' % escape(browse_revision_url)) + _check_origin_view_title(resp, origin_info["url"], "branches") + def _origin_releases_test_helper(client, origin_info, origin_snapshot): query_params = {"origin_url": origin_info["url"]} @@ -1066,6 +1075,8 @@ assert_contains(resp, '' % escape(browse_release_url)) assert_contains(resp, '' % escape(browse_revision_url)) + _check_origin_view_title(resp, origin_info["url"], "releases") + @given( new_origin(), visit_dates(), revisions(min_size=10, max_size=10), existing_release() @@ -1108,3 +1119,22 @@ assert resp.status_code == 200 assert_template_used(resp, "browse/branches.html") assert_contains(resp, '